export const onlineStatusOptions = [
  { label: '待付款', value: 1, type: 'danger' },
  { label: '已完成', value: 5, type: 'success' }
]

export const offlineStatusOptions = [
  { label: '待分配', value: 1, type: '' },
  { label: '待跟进', value: 2, type: 'info' },
  { label: '财务复审', value: 3, type: 'info' },
  { label: '已完成', value: 4, type: 'success' }
]

export const materialStatusOptions = [
  { label: '待付款', value: 1, type: 'danger' },
  { label: '已付款', value: 2, type: '' },
  { label: '待发货', value: 3, type: 'warning' },
  { label: '待收货', value: 4, type: '' },
  { label: '已完成', value: 5, type: 'success' }
]

export const getTagType = (str, status) => {
  let list = []
  switch (str) {
    case 'offline':
      list = offlineStatusOptions
      break
    case 'material':
      list = materialStatusOptions
      break
    case 'online':
      list = onlineStatusOptions
      break
    default:
      break
  }

  const info = list.find(item => item.value === status) ?? {}
  return info.type
}

export const getStatus = (str, status) => {
  let list = []
  switch (str) {
    case 'offline':
      list = offlineStatusOptions
      break
    case 'material':
      list = materialStatusOptions
      break
    case 'online':
      list = onlineStatusOptions
      break
    default:
      break
  }

  const info = list.find(item => item.value === status) ?? {}
  return info.label
}
